package com.antovita.militarymonkey.input;

import com.antovita.militarymonkey.MyGdxGame;
import com.antovita.militarymonkey.screens.MenuScreen;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.math.Rectangle;

public class MenuInput implements InputProcessor {

	private MyGdxGame gdx;
	public MenuInput(MyGdxGame gdx) {
		this.gdx = gdx;
	}
	
	@Override
	public boolean keyDown(int keycode) {
		if (keycode == Keys.BACK) {
			if (MenuScreen.start) gdx.setQuitScreen();
			else gdx.startGame();
		}
		return false;
	}

	@Override
	public boolean keyUp(int keycode) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean keyTyped(char character) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		if (gdx.startScreen.getStart().overlaps(new Rectangle(screenX, Gdx.graphics.getHeight() - screenY, 1, 1)))
			gdx.startGame();
		else if (gdx.startScreen.getQuit().overlaps(new Rectangle(screenX, Gdx.graphics.getHeight() - screenY, 1, 1)))
			gdx.setQuitScreen();
		else if (gdx.startScreen.getAbout().overlaps(new Rectangle(screenX, Gdx.graphics.getHeight() - screenY, 1, 1)))
			gdx.showAbout();
		else if (gdx.startScreen.getScores().overlaps(new Rectangle(screenX, Gdx.graphics.getHeight() - screenY, 1, 1)))
			gdx.showScores();
		return false;
	}

	@Override
	public boolean touchUp(int screenX, int screenY, int pointer, int button) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean touchDragged(int screenX, int screenY, int pointer) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean mouseMoved(int screenX, int screenY) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean scrolled(int amount) {
		// TODO Auto-generated method stub
		return false;
	}

}
